import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router'


const routes: Array<RouteRecordRaw> = [
  {
    path: '/',
    name: 'index',
    component: () => import('../views/index/index.vue'),
    redirect:'/tuijian',
    children: [
      {
        path: '/tuijian',
        name: 'tuijian',
        component: () => import('../views/index-tuijian/index.vue'),
      },
      {
        path: '/vue',
        name: 'vue',
        component: () => import('../views/index-vue/index.vue'),
      }
    ]
  },
  {
    path: '/my',
    name: 'my',
    component: () => import('../views/my/index.vue'),
    props: (route) => ({articleId: route.query.type})
  },
  {
    path: '/write',
    name: 'write',
    component: () => import('../views/write/index.vue')
  },
  {
    path: '/artices',
    name: 'aritces',
    component: () => import('../views/artices/index.vue')
  },
  {
    path: '/login',
    name: 'login',
    component: () => import('../views/login/index.vue')
  }
]

const router = createRouter({
  history: createWebHistory(),
  routes
})

export default router
